import 'dart:async';

import 'package:flutter/material.dart';

class DialogConstructor extends Dialog{

  _showTimer(context){
    Timer.periodic(
      Duration(milliseconds: 2000),(t){
        Navigator.pop(context);
        t.cancel();
      }
    );
  }
  
  @override
  Widget build(BuildContext context) {

    _showTimer(context);

    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: 100.0,
          height: 100.0,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(10)
          ),
          child: Icon(Icons.local_bar),
        ),
      ),
    );
  }
}